Skip to content

Fix OAuth2 native-image session definition initialization - #2193

Open
sdelamo wants to merge 1 commit into
5.1.xfrom
paperclip/mng-239-oauth2-native-metadata
Open

Fix OAuth2 native-image session definition initialization#2193
sdelamo wants to merge 1 commit into
5.1.xfrom
paperclip/mng-239-oauth2-native-metadata

Conversation

@sdelamo

@sdelamo sdelamo commented May 22, 2026

Copy link
Copy Markdown
Member

Summary

  • add security-oauth2 native-image metadata that initializes OAuth2 session-backed generated bean definitions at run time
  • cover nonce, state, and same-pattern PKCE session persistence definitions
  • add a focused classpath metadata assertion

Closes #870.

Tests

  • ./gradlew --no-daemon :micronaut-security-oauth2:test --tests io.micronaut.security.oauth2.Oauth2NativeImageMetadataTest -x compileTestGroovy
  • ./gradlew --no-daemon :micronaut-security-oauth2:jar
  • inspected the built JAR for META-INF/native-image/io.micronaut.security/micronaut-security-oauth2/native-image.properties and the three expected class names

Release Target

PR Assets

No generated or rendered artifacts changed; no PR-visible asset upload is required.


✨ This message was AI-generated using gpt-5

Copilot AI review requested due to automatic review settings May 22, 2026 10:15
@sdelamo sdelamo added the type: bug Something isn't working label May 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds GraalVM native-image metadata for the security-oauth2 module to defer initialization of session-backed OAuth2 bean definition classes to runtime, addressing native image build warnings (issue #870).

Changes:

  • Added native-image.properties for micronaut-security-oauth2 with --initialize-at-run-time entries for session persistence bean definition classes (nonce, state, PKCE).
  • Added a focused JUnit test that asserts the packaged metadata file contains the expected native-image arguments/class names.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
security-oauth2/src/test/java/io/micronaut/security/oauth2/Oauth2NativeImageMetadataTest.java Verifies the module JAR contains the expected native-image metadata entries for runtime initialization.
security-oauth2/src/main/resources/META-INF/native-image/io.micronaut.security/micronaut-security-oauth2/native-image.properties Adds GraalVM native-image args to initialize session persistence bean definition classes at runtime.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something isn't working

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Remove OAuth 2 GraalVM Warnings

2 participants